﻿@model CustomerAddressEditModel
@using SpotsHub.Gateway.Models.Customer;
@{
    var dataDictAddress = new ViewDataDictionary();
    //Merge ModelState (required for validation)
    dataDictAddress.ModelState.Merge(ViewData.ModelState);
    dataDictAddress.TemplateInfo.HtmlFieldPrefix = "Address";
}
<div class="address-book-new">
    <div class='row edit-address edit-address-new'>
        <div class="address-info">
            @Html.ValidationSummary(false)
            @Html.HiddenFor(model => Model.Address.Id)
            @Html.HiddenFor(model => Model.Address.CountryId)

            <div class="info-input col-sm-4">
                @Html.RequiredHint() @Html.LabelFor(model => model.Address.FirstName)
                @Html.TextBoxFor(model => Model.Address.FirstName, new { id = "FirstNamsse-" + Model.Address.Id.ToString(), Class = "form-control" })
                @Html.ValidationMessageFor(model => model.Address.FirstName)
            </div>

            <div class="info-input col-sm-4">
                @Html.RequiredHint() @Html.LabelFor(model => model.Address.LastName)
                @Html.TextBoxFor(model => Model.Address.LastName, new { id = "LastName-" + Model.Address.Id.ToString(), Class = "form-control" })
                @Html.ValidationMessageFor(model => model.Address.LastName)
            </div>

            @if (Model.Address.CompanyEnabled)
            {
                <div class="info-input col-sm-4">
                    @Html.LabelFor(model => model.Address.Company)
                    @Html.TextBoxFor(model => model.Address.Company, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Address.Company)
                </div>
            }
            
            @if (Model.Address.StreetAddressEnabled)
            {

                <div class="info-input col-sm-8">
                    @Html.RequiredHint() @Html.LabelFor(model => model.Address.Address1)
                    @Html.TextBoxFor(model => model.Address.Address1, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Address.Address1)
                </div>
            }
            
            @if (Model.Address.StreetAddress2Enabled)
            {
                    @*<div class="info-label">
                        @Html.LabelFor(model => Model.Address.Address2)
                    </div>*@
                    <div class="info-input col-sm-4">
                        @Html.LabelFor(model => model.Address.Address2)
                        @Html.TextBoxFor(model => model.Address.Address2, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.Address.Address2)
                    </div>
            }
            @if (Model.Address.CityEnabled)
            {
                <div class="info-input col-sm-4">
                    @Html.RequiredHint() @Html.LabelFor(model => model.Address.City)
                    @Html.TextBoxFor(model => model.Address.City, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Address.City)
                </div>
            }
            
            @if (Model.Address.CountryEnabled && Model.Address.StateProvinceEnabled)
            {
                <div class="info-input col-sm-2">
                    @Html.RequiredHint() @Html.LabelFor(model => model.Address.StateProvinceId)
                    @Html.DropDownListFor(model => model.Address.StateProvinceId, Model.Address.AvailableStates, new { @class = "form-control province-form" })
                </div>
            }
            @if (Model.Address.CountryEnabled)
            {
                <div class="info-input col-sm-2">
                    @Html.LabelFor(model => model.Address.CountryName)
                    @Html.TextBoxFor(model => Model.Address.CountryName, new { Class = "input-display form-control country-form", disabled = "disabled" })
                </div>
            }

            @if (Model.Address.ZipPostalCodeEnabled)
            {
                <div class="info-input col-sm-4">
                    @Html.RequiredHint() @Html.LabelFor(model => model.Address.ZipPostalCode)
                    @Html.TextBoxFor(model => model.Address.ZipPostalCode, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Address.ZipPostalCode)
                </div>
            }
            <div class="info-input col-sm-4">
                @Html.LabelFor(model => model.Address.Email)
                @Html.TextBoxFor(model => model.Address.Email, new { @class = "form-control" })
                @Html.HiddenFor(model => model.Address.Email)
            </div>

            @if (Model.Address.PhoneEnabled)
            {
                <div class="info-input col-sm-4">
                    @Html.RequiredHint() @Html.LabelFor(model => model.Address.CellPhoneNumber)
                    @Html.TextBoxFor(model => model.Address.CellPhoneNumber, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Address.CellPhoneNumber)
                </div>

                <div class="info-input col-sm-4">
                    @Html.LabelFor(model => model.Address.PhoneNumber)
                    @Html.TextBoxFor(model => model.Address.PhoneNumber, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Address.PhoneNumber)
                </div>
            }
            <div class="clear"></div>
        </div>
        </div>
    <div class="clear"></div>
</div>